package com.heyqing.topic.InvertTree_0226;

import java.util.Objects;

/**
 * ClassName:InvertTree
 * Package:com.heyqing.topic.InvertTree_0226
 * Description:
 *
 * @Date:2024/9/23
 * @Author:Heyqing
 */
public class InvertTree {
    public TreeNode invertTree(TreeNode root) {
        if (Objects.isNull(root)) return null;
        TreeNode left = invertTree(root.left);
        TreeNode right = invertTree(root.right);
        root.left = right;
        root.right = left;
        return root;
    }

}
